import cv2
# import core
import time


def main():
    cap = cv2.VideoCapture(0)

    print("帧率为: {}".format(cap.get(cv2.CAP_PROP_FPS)))

    strat = time.time()
    d = 0
    while cap.isOpened():
        ret, frame = cap.read()

        d += 1
        if ret == False:
            break
        # if d % 3 == 1:
        #     landmark = core.detector(frame)
        # if len(landmark) != 0:
        #     frame = core.draw_connections(frame, landmark)
        #     angle = core.draw_angle(landmark)
        t = time.time()
        # cv2.putText(frame, str(int(d / (t - strat))), (10, 70), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 3)
        # cv2.imshow("123", frame)
        print("FPS: {:.2f}".format(d / (t - strat)))
        # if cv2.waitKey(1) & 0xff == ord("q"):
        #     break

    cv2.destroyAllWindows()
    cap.release()

if __name__ == '__main__':
    main()
